var t,
  e = require("../../utils/http.js"),
  a = require("../../utils/api.js"),
  n = require("../../utils/language/switchLanguage.js");
Page({
  data: { is_show: !1, content: {} },
  onLoad: function (t) {
    this.setData({
      orderNo: t.orderNo,
      merchantNo: wx.getStorageSync("merchantNo"),
    }),
      this.getOrderDetail({ orderSn: t.orderNo }),
      this.initLanguage();
  },
  initLanguage: function () {
    var t = n.languageVersion(wx.getStorageSync("language"));
    this.setData({ _t: t, languageType: wx.getStorageSync("language") }),
      wx.setNavigationBarTitle({ title: t["订单信息"] });
  },
  getOrderDetail: function (n) {
    var o = this;
    e.getOrderDetail(n).then(function (e) {
      var n = e.data;
      o.setData({ content: n }),
        (t = setInterval(function () {
          var n = a.TicketCountDown(e.data.createTime);
          0 == n && clearInterval(t), o.setData({ countDown: n });
        }, 1e3));
    });
  },
  CancelOrder: function (t) {
    var n = t.currentTarget.dataset.orderno,
      o = this;
    wx.showModal({
      title: o.data._t["提示"],
      content: o.data._t["是否确认取消？"],
      confirmText: o.data._t["确定"],
      cancelText: o.data._t["取消"],
      success: function (t) {
        if (t.confirm) {
          var i = { merchantNo: o.data.merchantNo, orderSn: n };
          wx.showLoading({ title: o.data._t["取消"] + "..." }),
            setTimeout(function () {
              wx.hideLoading();
            }, 1e3),
            e.CancelOrder(i).then(function (t) {
              wx.hideLoading();
              var e = getCurrentPages(),
                n = e[e.length - 2],
                i = n.data.params;
              n.setData({ refresh: !0 }),
                (i.page = 1),
                n.getOrderList(i),
                a.showMsg(o.data._t["取消成功"]),
                wx.navigateBack();
            });
        }
      },
    });
  },
  copyText: function (t) {
    var e = t.currentTarget.dataset.text;
    wx.setClipboardData({
      data: e,
      success: function (t) {
        wx.hideLoading(), a.showMsg(that.data._t["复制成功"]);
      },
    });
  },
  CallPhone: function () {
    wx.makePhoneCall({ phoneNumber: wx.getStorageSync("telphoneNumber") });
  },
  openTip: function () {
    this.setData({ is_show: !0 });
  },
  Cancel: function (t) {
    this.setData({ is_show: !1 });
  },
  toPage: function () {
    wx.navigateTo({
      url:
        "plugin-private://wx393d60d93f70599c/pages/Rule/index?orderType=" +
        this.data.content.orderType +
        "&teamType=" +
        this.data.content.teamType,
    });
  },
  onReady: function () {},
  onShow: function () {},
  onHide: function () {},
  onUnload: function () {
    clearInterval(t);
  },
  onPullDownRefresh: function () {},
  onReachBottom: function () {},
});
